var windowName = "fileInfo";
var Page
apiready = function(){
    onWindowShow(function () {
    })
    onWindowHide(function () {
    })
    console.log("index page is OK");
    Page = createVM("#Page",{
        //页面数据
        en: {
            "id": "",
            "category": "",
            "name": "",
            "money": "",
            "other": "",
            "status": ""
        },
        cat:[],
        zbdw:[],
        files:[]
    },{
        //页面方法
        "init":function () {
            var data = getData4Page()
            getData(this,data.id)
        }
        ,"submit":function() {
            var _this = this
            this.$refs.form.validate().then((result) => {
                logJson(result)
                if (result){
                    var data = createForm(this.en);
                    apiPost("/app/file/info",data,function (res) {
                        logJson(res)
                        showToast(res.message)
                    })

                }else{
                    showToast("请检查输入")
                }
            });
        },
    })

    Page.init()
}

function getData(_this,id) {
    if(isFalse(id)){
        showLoading()
    }
    apiGet("/app/file/info",{id:id},function (res) {
        console.log(JSON.stringify(res));
        _this.cat = res.data.cat
        _this.en = res.data.en
    });
}